package com.lms.desiginmode.builder;

import com.alibaba.fastjson.JSON;
import com.google.common.collect.Maps;

import java.util.Map;

public class RequestBody {
    private Map<String, Object> entity;
    private RequestBody(){}

    public static RequestBody create(){
        RequestBody requestBody = new RequestBody();
        requestBody.entity= Maps.newHashMap();
        return requestBody;
    }
    public RequestBody put(String key,Object value){
        entity.put(key, value);
        return this;
    }

    public RequestBody put(Map<String, Object> entity){
        this.entity.putAll(entity);
//        this.entity=entity;
        return this;
    }

    public String toJson(){
        return  JSON.toJSONString(entity);
    }

}
